<!--conf
<sample>
              <product version="1.4" edition="pro"/>
                     <modifications>
                            <modified date="070101"/>
                     </modifications>
               </sample>
 --> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>Grid related API</title>	  	
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" type="text/css" href="../../../codebase/dhtmlx.css"/>
	<script src="../../../codebase/dhtmlx.js"></script>
</head>

<body>
	
	<h1>Grid related API</h1>
	<p>
          Use same methods in Grid and TreeGrid
	</p>


	<table width="700">
		<tr>
			<td width="50%" valign="top">
				<div id="gridbox" style="width=350px;height:150px;background-color:white;"></div>
			</td>
			<td valign="top">
				<div id="gridbox2" style="width=350px;height:150px;background-color:white;border:1px solid blue;" align="right"></div>
			</td>
		</tr>
		<tr>
			<td colspan="2">
<table>
	<tr>
			<td>
				<a href="javascript:mygrid.setHeaderCol(1,'New Header')">setHeaderCol</a><br>
				<a href="javascript:mygrid.copyRowContent(mygrid.getRowId(0),mygrid.getSelectedId())">copyRowContent (ex.:from first to selected)</a><br>
				<a href="javascript:mygrid.clearSelection()">clearSelection</a><br>
				<a href="javascript:mygrid.setSelectedRow(mygrid.getRowId(1))">setSelectedRow (ex.:second)</a><br>
				<a href="javascript:mygrid.setEditable(!mygrid.isEditable)">setEditable (ex.:on/off)</a><br>
				<a href="javascript:mygrid.setUserData(mygrid.getSelectedId(),'ud2','this value was set with script')">setUserData (ex.: to selected row)</a><br>
				<a href="javascript:alert(mygrid.getUserData(mygrid.getSelectedId(),'ud2'))">getUserData (ex.: of selected row)</a><br>

				<a href="javascript:mygrid.moveRowDown(mygrid.getSelectedId())">moveRowDown (ex.:selected)</a><br>
				<a href="javascript:mygrid.moveRowUp(mygrid.getSelectedId())">moveRowUp (ex.:selected)</a><br>
				<a href="javascript:alert(mygrid.getColumnCount())">getColumnCount</a><br>
				<a href="javascript:alert(mygrid.getRowsNum())">getRowsNum</a><br>
				<a href="javascript:alert(mygrid.getAllItemIds())">getAllItemIds</a><br>
				<a href="javascript:alert(mygrid.isItemExists('14'))">isItemExists (with id=14)</a><br>
				<a href="javascript:mygrid.setRowTextStyle(mygrid.getSelectedId(),'color:red;font-family:verdana;font-size:14px;')">setRowTextStyle (ex.:selected)</a><br>
				<a href="javascript:mygrid.setRowTextBold(mygrid.getSelectedId())">setRowTextBold (ex.:selected)</a><br>
				<a href="javascript:mygrid.setRowTextNormal(mygrid.getSelectedId())">setRowTextNormal (ex.:selected)</a><br>
				<a href="javascript:mygrid.clearAll()">clearAll</a><br>
			</td>
			<td>
				<a href="javascript:mygrid.setColumnIds('A,B')">setColumnIds (A,B)</a><br>
				<a href="javascript:alert(mygrid.getColumnId(0))">getColumnId (ex.:first)</a><br>
				<a href="javascript:alert(mygrid.getColIndexById('B'))">getColIndexById (ex.: B)</a><br>
				<a href="javascript:mygrid.setRowId(mygrid.getRowIndex(mygrid.getSelectedId()),'newid')">setRowId (ex.: selected)</a><br>
				<a href="javascript:alert(mygrid.getRowId(mygrid.getRowIndex(mygrid.getSelectedId())))">getRowId (ex.:selected)</a><br>
				<a href="javascript:alert(mygrid.getRowIndex(mygrid.getSelectedId()))">getRowIndex (ex.:selected)</a><br>
				<a href="javascript:alert(mygrid.getColWidth(mygrid.getSelectedCellIndex()))">getColWidth (ex.:of selected cell)</a><br>
				<a href="javascript:alert(mygrid.getSelectedCellIndex())">getSelectedCellIndex</a><br>
				<a href="javascript:alert(mygrid.getSelectedId())">getSelectedId</a><br>
				<a href="javascript:mygrid.deleteSelectedItem()">deleteSelectedItem</a><br>
				<a href="javascript:void(0)" onclick="mygrid.deleteRow(mygrid.getSelectedId())">deleteRow (ex.: selected)</a><br>
				<a href="javascript:mygrid.setMultiselect(!mygrid.selMultiRows)">setMultiselect (on/off)</a><br>
				<a href="javascript:mygrid.selectRow(0)">selectRow (ex.:first one)</a><br>
				<a href="javascript:mygrid.selectCell(1,1)">selectCell (ex.: second cell of second row)</a><br>
				<a href="javascript:mygrid.attachToObject(document.getElementById('gridbox2'))">attachToObject</a><br>
			</td>
		</tr>
</table>
            </td>
		</tr>
	</table>



<script>
		mygrid = new dhtmlXGridObject('gridbox');

		
		mygrid.setImagePath("../../../codebase/imgs/");
		mygrid.setHeader("Car,Mileage,Volume,State A,State B");
		mygrid.setInitWidths("150,100,100,50,50")
		mygrid.setColAlign("left,left,left,center,center")
		mygrid.setColTypes("tree,ed,txt,ch,ch");
		mygrid.setColSorting("str,str,str,na,str")

		mygrid.init();
		mygrid.setSkin("dhx_skyblue")

	   	mygrid.loadXML("../common/test_list_1.xml");
</script>

</body>
</html>
